package com.hserver.statistics.task;


import com.hserver.statistics.util.StatisticsUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import top.hserver.core.ioc.annotation.Bean;
import top.hserver.core.ioc.annotation.Task;

@Bean
public class SaveTask {

    private static Logger log = LoggerFactory.getLogger(SaveTask.class);

    /**
     * 5分钟
     */

    @Task(name = "自动保存数据", time = 1000 * 60 * 5 + "")
    public void saveStatistics() {
        StatisticsUtil.save();
        log.info(System.currentTimeMillis() + "");
    }

    /**
     * 每晚一点不见不散,没写task
     */
    public void RemoveOldFile() {
        StatisticsUtil.RemoveOldFile();
    }
}